package com.ly.emp.controller.common;

import com.ly.common.core.bean.R;
import com.ly.common.core.bean.vo.TreeVO;
import com.ly.emp.bean.vo.BaseSuitunitOrgTreeVO;
import com.ly.emp.entity.EpmBaseRel;
import com.ly.emp.entity.EpmBaseSuitunitOrg;
import com.ly.emp.entity.EpmTeamConversionMode;
import com.ly.emp.service.IEmpCommonService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 公共配置获取
 *
 * @author luoyun
 * @Date: 2025/5/13 14:17
 * @Note:
 */
@Tag(name = "hub公共-配置模块")
@Slf4j
@RestController
@RequestMapping("/emp/common")
@RequiredArgsConstructor
public class EmpCommonController {

    private final IEmpCommonService empCommonService;

    /**
     * 获取班组人员
     * @param type: "true":考核  "false":不考核
     * @param orgCode
     * @return
     */
    @Operation(summary = "获取班组人员")
    @GetMapping("/getBaseRelList")
    public R<List<EpmBaseRel>> getBaseRelList(String type, String orgCode) {
        return empCommonService.getBaseRelList(type,orgCode);
    }

    /**
     * 获取折算模式
     *
     * @param
     * @return
     */
    @Operation(summary = "获取折算模式")
    @GetMapping("/getConversionModeList")
    public R<List<EpmTeamConversionMode>> getConversionModeList() {
        return empCommonService.getConversionModeList();
    }

    /**
     * 获取管理的绩效部门
     *
     * @param
     * @return
     */
    @Operation(summary = "获取管理的绩效部门")
    @GetMapping("/getPluraList")
    public R<List<EpmBaseSuitunitOrg>> getPluraList(@RequestParam(value = "类型（1：负责人  默认：绩效兼职）", required = false) String type) {
        return empCommonService.getPluraList(type);
    }

    /**
     * 绩效部门树
     *
     * @return
     */
    @Operation(summary = "查询绩效部门树")
    @GetMapping("/findTree")
    public R<BaseSuitunitOrgTreeVO> findTree() {
        return empCommonService.findTree();
    }

    /**
     * 获取班组人员
     * @param type: "true":考核  "false":不考核
     * @param orgCode
     * @return
     */
    @Operation(summary = "获取班组人员树")
    @GetMapping("/getBaseRelTree")
    public R<List<TreeVO>> getBaseRelTree(String type, String orgCode) {
        return empCommonService.getBaseRelTree(type,orgCode);
    }

}
